var express = require('express');
var router = express.Router();

const {
    getMd5
} = require("../utils/crypto"); //引入MD5加密工具


const {
    registers,
    isRegisters
} = require('../service/lessorsService');

//配置二级路径
//出租方注册
router.post('/registers', async function (req, res, next) {
    const {
        account,
        password,
        telephone
    } = req.body;
    const newpassword = getMd5(password);
    const result = await registers({
        account,
        password: newpassword,
        telephone
    });
    console.log("____________________", req.body);
    console.log('_result', result);
    res.send(result);
});

//出租方验证账号
router.post('/isRegisters', async function (req, res, next) {

    const result = await isRegisters(req.body);
    res.send(result);
});
module.exports = router;